package ServerTest;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;

public class Server {
    public static final Map<Socket,String> userMap = new HashMap<>();
    public static void main(String[] args) {
            //创建服务器启动端
        try {
            ServerSocket server = new ServerSocket(ConstantServer.SERVER_PORT);
            //打印启动日志
            System.out.println("服务器启动成功...");
            //循环监听客户端连接
            while (true) {
                Socket socket = server.accept();
                //启动一个线程处理客户端请求
                new ServerReaderThread(socket).start();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
